# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=pkg-config
pkgver=0.28
pkgrel=2
pkgdesc="A system for managing library compile/link flags"
arch=('i686' 'x86_64')
url="http://pkgconfig.freedesktop.org/wiki/"
license=('GPL')
groups=('base-devel')
depends=('glib2')
provides=("pkgconfig=${pkgver}")
conflicts=('pkgconfig')
replaces=('pkgconfig' 'pkgconf')
source=(http://pkgconfig.freedesktop.org/releases/${pkgname}-${pkgver}.tar.gz
        glib-cygwin.patch
        pkg-config-0.28-msys2.patch)
md5sums=('aa3c86e67551adc3ac865160e34a2a0d'
         '0c9c4318b29f73dab22f0bdcc7d5eeb4'
         '36d36b6b63c3b82e3c24e662afef247e')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p2 -i ${srcdir}/glib-cygwin.patch
  patch -p1 -i ${srcdir}/pkg-config-0.28-msys2.patch

  autoreconf -fi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure \
    --build=${CHOST} \
    --host=${CHOST} \
    --prefix=/usr \
    --with-internal-glib \
    --enable-indirect-deps
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
